﻿
function setEvents() {
    //ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
    $('.articleHead').mouseenter(function () {
        //REMOVE THE ON CLASS FROM ALL BUTTONS
        $('.articleHead').removeClass('on');
        //NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
        $('.articleContent').slideUp(1000);
        //IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
        if ($(this).next().is(':hidden') === true) {
            //ADD THE ON CLASS TO THE BUTTON
            $(this).addClass('on');
            //OPEN THE SLIDE
            $(this).next().slideDown(1000);
        }
    });


    /*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
    //ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER 
    $('.articleHead').mouseover(function () {
        $(this).addClass('over');
        //ON MOUSEOUT REMOVE THE OVER CLASS
    }).mouseout(function () {
        $(this).removeClass('over');
    });

    /*** END REMOVE IF MOUSEOVER IS NOT REQUIRED ***/

    $('.articleContent').hide();
}
